<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>抽题管理</title>
</head>
<body>
<div class="easyui-layout" data-options="fit:true,border:false">
  <div data-options="region:'west',title:'题类',split:true,hideCollapsedContent:false" style="width:240px;">
    <ul id="association_selected_questions_tree_20210426"></ul>
  </div>
  <div data-options="region:'center',border:true">
    <table id="association_selected_questions_dg_20210426"></table>
  </div>
</div>

<div id="tb_association_selected_questions_dg_20210426" style="padding:2px 5px;">
  <a href="javascript:" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="$('#dialog_association_selected_questions_addOrUpdateOrAdd').dialog('open').dialog('center').dialog('setTitle','抽题')">抽题</a>
  <a href="javascript:" class="easyui-linkbutton" iconCls="icon-edit" plain="true">查看</a>
  <a href="javascript:" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
  <a href="javascript:" class="easyui-linkbutton"  plain="true">导出</a>
</div>

<div id="dialog_association_selected_questions_addOrUpdateOrAdd" style="display: none;">
  <div class="easyui-layout" fit="true" border="false">
    <div data-options="region:'east',split:false" title="考生名单" style="width:50%;">

      <div class="easyui-tabs" fit="true" id="association_selected_questions_table-20210609" border="false"></div>

    </div>
    <div data-options="region:'center'">
      <form id="association_selected_questions_form_20210426" method="post" data-options="novalidate:true">
        <div style="margin-bottom:20px">
          <input class="easyui-numberspinner" value="0" data-options="label:'单选数量:',spinAlign:'horizontal',required:true" style="width:45%;">
          <input class="easyui-numberspinner" value="0" data-options="label:'每题分值:',spinAlign:'horizontal',required:true" style="width:45%;">
          <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:9%">选题</a>
        </div>
        <div style="margin-bottom:20px">
          <input class="easyui-numberspinner" name="email" style="width:45%" data-options="label:'多选数量:',spinAlign:'horizontal',required:true">
          <input class="easyui-numberspinner" name="name" style="width:45%" data-options="label:'每题分值:',spinAlign:'horizontal',required:true">
          <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:9%">选题</a>
        </div>
        <div style="margin-bottom:20px">
          <input class="easyui-numberspinner" name="subject" style="width:45%" data-options="label:'填空数量:',spinAlign:'horizontal',required:true">
          <input class="easyui-numberspinner" name="name" style="width:45%" data-options="label:'每题分值:',spinAlign:'horizontal',required:true">
          <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:9%">选题</a>
        </div>
        <div style="margin-bottom:20px">
          <input class="easyui-numberspinner" name="message" style="width:45%;" data-options="label:'判断数量:',spinAlign:'horizontal'">
          <input class="easyui-numberspinner" name="name" style="width:45%" data-options="label:'每题分值:',spinAlign:'horizontal',required:true">
          <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:9%">选题</a>
        </div>
        <div style="margin-bottom:20px">
          <input class="easyui-numberspinner" name="message" style="width:45%;" data-options="label:'简答数量:',spinAlign:'horizontal',">
          <input class="easyui-numberspinner" name="name" style="width:45%" data-options="label:'每题分值:',spinAlign:'horizontal',required:true">
          <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:9%">选题</a>
        </div>
        <div style="margin-bottom:20px">
          <input class="easyui-datetimebox" name="message" style="width:33%;" data-options="label:'考试时间:'">
          <input class="easyui-datetimebox" name="name" style="width:33%" data-options="label:'结束时间:',required:true">
          进入考试时间<input class="easyui-numberspinner" value="10" data-options="spinAlign:'horizontal'" style="width:100px;">（提前几分钟）
        </div>
        <div style="margin-bottom:20px">
          <select class="easyui-combobox" name="language" label="抽题规则:" panelHeight="auto" style="width:49%">
            <option value="bg">同卷同顺序</option>
            <option value="ar">AB卷（学号最后一位奇偶数）</option>
            <option value="ca">同卷随机顺序</option>
            <option value="zh-cht">随机卷</option>
          </select>
          <select class="easyui-combobox" name="language" label="考题难度:" panelHeight="auto" style="width:49%">
            <option value="bg">简单</option>
            <option value="ar">中等</option>
            <option value="ca">难</option>
          </select>
        </div>
        <div style="margin-bottom:20px">
          <select class="easyui-combobox" name="language" data-options="label: '选择系:',panelHeight:'auto',multiple:true" style="width:99%">
            <option value="1">计算机与信息工程系</option>
          </select>
        </div>
        <div style="margin-bottom:20px">
          <input id="classStudent20210609" class="easyui-combotree" data-options="method:'get',label:'选择班级:',multiple:true" style="width:100%">
        </div>
      </form>
    </div>
  </div>
</div>
<div id="dialog_association_selected_questions_addOrUpdateOrAdd_button" style="display: none;">
  <a class="easyui-linkbutton"  href="javascript:" >放弃</a>
  <a class="easyui-linkbutton"  href="javascript:">保存</a>
</div>


<script>
  $.getJSON('./../category/getCategory',{state:1}, function(json){
    let data = json.rows;
    $('#classStudent20210609').combotree({
      onlyLeafCheck:true,
      data: data,
      onCheck:function (node, checked){
        if(checked){
          $('#association_selected_questions_table-20210609').tabs('add',{
            title: node.text,
            content: '<table class="easyui-datagrid"  fit="true" data-options="' +
                    'singleSelect:true,' +
                    'collapsible:true,' +
                    'url:\'./../studentInformation/queryStudentInformationPid\',' +
                    'queryParams: {\n' +
                    '   pid: ' + node.id +
                    ' },' +
                    'sortName: \'id\',' +
                    'sortOrder: \'desc\',' +
                    'fitColumns: true, ' +
                    'rownumbers: true,' +
                    'border: false,' +
                    'method:\'get\'">\n' +
                    '        <thead>\n' +
                    '            <tr>\n' +
                    '                <th data-options="field:\'id\',width:80">学号</th>\n' +
                    '                <th data-options="field:\'name\',width:80">姓名</th>\n' +
                    '                <th data-options="field:\'sex\',width:40">性别</th>\n' +
                    '                <th data-options="field:\'sfz\',width:100">身份证</th>\n' +
                    '                <th data-options="field:\'status\',width:80">学生状态</th>\n' +
                    '            </tr>\n' +
                    '        </thead>\n' +
                    '    </table>',
            closable: true
          });
        }else {
          var tab = $('#association_selected_questions_table-20210609').tabs('getSelected');
          if (tab){
            $('#association_selected_questions_table-20210609').tabs('close', node.text);
          }
        }
      }
    });
  });

  $('#association_selected_questions_tree_20210426').tree({
    method:'get',
    url:'./../structure/queryTreeAll',
    onClick: function(node){
      //判断点击的是叶节点
      if($(this).tree('isLeaf',node.target)){
        // $('#association_selected_questions_dg_20210426').datagrid({
        //   url:'./../paperTwo/queryPaperTwoPid',
        //   queryParams: {
        //     pid: node.id,
        //     titleType:2
        //   }
        // });
        return;
      }
    }
  });

  $('#association_selected_questions_dg_20210426').datagrid({
    method:'get',
    sortName:'id',
    sortOrder:'desc',
    fit:true,
    fitColumns:true,
    border:false,
    singleSelect:true,
    nowrap:false,//设置为 true，则把数据显示在一行里。设置为 true 可提高加载性能。
    columns:[[
      {field:'title',title:'考试类型',width:80},
      {field:'title1',title:'抽题规则',width:80},
      {field:'createTime',title:'创建时间',width:80,align:'center'},
      {field:'beginTime',title:'开始时间',width:80,align:'center'},
      {field:'endTime',title:'结束时间',width:80,align:'center'},
      {field:'nanduxishu',title:'难易度',width:80,align:'center',
        formatter: function(value,row,index){
          if(value == '1'){
            return '简单';
          }
          if(value == '2'){
            return '中等';
          }
          if(value == '3'){
            return '难';
          }
        }
      },
      {field:'status',title:'状态',width:80,align:'center',
        formatter: function(value,row,index){
          if(value == '1'){
            return '未开始';
          }
          if(value == '2'){
            return '考试中';
          }
          return '考试结束';
        }
      }
    ]],
    toolbar:'#tb_association_selected_questions_dg_20210426',
    pagination:true,
    rownumbers:true
  });

  $(function (){
    $('#dialog_association_selected_questions_addOrUpdateOrAdd').dialog({
      width: '100%',
      height: '100%',
      closed: true,
      modal: true,
      onBeforeOpen: function (none){
        let treeSelect = $('#association_selected_questions_tree_20210426').tree('getSelected');
        if(treeSelect){
          if($('#association_selected_questions_tree_20210426').tree('isLeaf',treeSelect.target)){
            return true;
          }
        }
        new jBox('Notice', {
          color: 'red',
          autoClose: 2500,
          content: '请先选中科目！',
          showCountdown: true,
          animation: 'slide'
        });
        return false;
      },
      buttons:'#dialog_association_selected_questions_addOrUpdateOrAdd_button'
    });
  });
</script>
</body>
</html>